﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using PMPUtils.Form;
using PMPUtils.Report;

namespace PMP.Reports
{
    public partial class TMDashboard : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            FormUtil.Authenticate(Session, Response);

            try
            {
                RefreshForm();
            }
            catch (Exception ex)
            {
                Messenger.Show(Response, "Error: " + ex.Message);
                return;
            }
        }

        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                RefreshForm();
            }
            catch (Exception ex)
            {
                Messenger.Show(Response, "Error: " + ex.Message);
                return;
            }
        }

        private void RefreshForm()
        {
            TMDashboardOperator.RefreshOverallTMDashboard(CrystalReportSource1);
            TMDashboardOperator.RefreshWeeklyTMDashboard(CrystalReportSource2);
            TMDashboardOperator.RefreshSprintTMDashboard(CrystalReportSource3);
            TMDashboardOperator.RefreshOverallTMDashboardByTeam(CrystalReportSource4);
        }
    }
}
